;(function (document) {
  console.log("----------- APlayer Init -----------");

  // 引入样式文件
  var css = document.createElement("link");
  css.href = "//zfy95.gitee.io/static/lib/APlayer/APlayer.min.css";
  css.rel = "stylesheet";
  css.type = "text/css";
  document.body.appendChild(css);
  var myCss = document.createElement("style");
  myCss.type = "text/css";
  myCss.innerHTML =
    "#aplayer.aplayer .aplayer-miniswitcher .aplayer-icon { -webkit-transform: rotateY(0);transform: rotateY(0); } \n" +
    "#aplayer.aplayer.aplayer-fixed.aplayer-narrow .aplayer-miniswitcher .aplayer-icon { -webkit-transform: rotateY(180deg);transform: rotateY(180deg); }";
  document.body.appendChild(myCss);

  // 创建元素节点
  var div = document.createElement("div");
  div.id = "aplayer";
  document.body.appendChild(div);

  // 引入脚本文件
  var js = document.createElement("script");
  js.onload = js.onreadystatechange = function () {
    if (
      !this.readyState ||
      this.readyState === "loaded" ||
      this.readyState === "complete"
    ) {
      if (typeof APlayer !== "undefined") {
        new APlayer({
          container: document.getElementById("aplayer"),
          fixed: true,
          lrcType: 3,
          audio: {
            name: "有幸",
            artist: "老光",
            url:
              "//zfy95.gitee.io/static/lib/APlayer/%E8%80%81%E5%85%89-%E6%9C%89%E5%B9%B8.mp3",
            cover: "//zfy95.gitee.io/static/lib/APlayer/hikarunara.jpg",
            lrc:
              "//zfy95.gitee.io/static/lib/APlayer/%E8%80%81%E5%85%89-%E6%9C%89%E5%B9%B8.lrc",
          },
        });
        document.querySelector("#aplayer").style.zIndex = "9999";
        document.querySelector("#aplayer .aplayer-body").style.left = "auto";

        console.log("----------- APlayer Work -----------");
      } else {
        console.log("----------- APlayer Load Failed -----------");
      }
    } else {
      console.log("----------- APlayer Load Failed -----------");
    }
    js.onload = js.onreadystatechange = null;
  };
  js.src = "//zfy95.gitee.io/static/lib/APlayer/APlayer.min.js";
  js.type = "text/javascript";
  document.body.appendChild(js);
})(document);
